<template>
	<view class="payResOuter">
		<image src="../../static/images/zfcg.png" mode=""></image>
		<text>支付成功</text>
		<text class="money">{{payResData.money}}</text>
		<view class="btn" @click="payDetail">
			查看详情
		</view>
	</view>
</template>

<script>
	import {
		serviceApi
	} from '../../api/paiModule/home.js'
	export default {
		data() {
			return {
				payment_id: null,
				payResData: null,
			};
		},
		onLoad(options) {
			console.log(options);
			this.payment_id = options.payment_id
		},
		onShow() {
			this.getPayRes()
		},
		methods: {
			// 获取支付结果
			async getPayRes() {
				const {
					data: res
				} = await serviceApi({
					method: "payments.getinfo",
					payment_id: this.payment_id,
					token: uni.getStorageSync('token')
				})
				console.log(res);
				this.payResData = res.data
			},

			// 跳转详情
			payDetail() {
				uni.navigateTo({
					url: '/pages/payDetail/payDetail?order_id=' + this.payResData.rel[0].source_id
				})
			},
		},
	}
</script>

<style lang="scss" scoped>
	.payResOuter {
		width: 100%;
		height: 91vh;
		background-color: #f8f8f8;
		display: flex;
		flex-direction: column;
		justify-content: flex-start;
		align-items: center;
		padding-top: 100px;
		line-height: 30px;

		image {
			width: 60px;
			height: 60px;
			margin-bottom: 10px;
		}

		.money {
			color: #ff0000;
		}

		.btn {
			border: 1px solid #b1b1b1;
			background-color: #fff;
			padding: 0px 10px;
			font-size: 12px;
			color: #848484;
			margin-top: 40px;
		}
	}
</style>